define(['jquery', 'api', 'user', 'util'], function($, api, user, util) {
    var vm,
        controller = {
            init: function(id) {
                if (!user.checkLogin())
                    return;
                    
                api.headerShow(1);
				api.headerTitle(L('html_title_article_rule'));
                api.footerShow(0);
                api.setTitle(L('html_title_article_rule'));
                this.render();
            },
            render: function() {
            	var that=this;
            	$('#common').html('<div id="rule"></div>');
                require(['text!pages/article/rule.html', 'Vue'], function(tpl, Vue) {
                    vm = new Vue({
                        el: '#rule',
                        data: {
                            show: true,
                            rule: {'content': ''}
                        },
                        template: tpl
                    });
                    
                    that.loadRule();
                });
            },
            loadRule: function() {
                api.articleList({count: 1, typeid: 3}, function(rs) {
                    if (rs.retcode == 0 && rs.data) {
                        vm.rule = rs.data[0];
                    }
                })
            },
            onRouteChange: function() {
                if (vm)
                    vm.show = false;
            }
        }
    return controller;
})